#include <atlbase.h>

#include <string>
#include <algorithm>
#include <memory>

#include "InputHip.h"
#include "ImageElement.h"

using namespace std;


CInputHip::CInputHip(void)
{
}


CInputHip::~CInputHip(void)
{
}

void CInputHip::DoFill(IHTMLDocument2* document) throw(...)
{
	if(!document)
		throw wstring(L"Input parameter document is null!");

	CImageElement* img = dynamic_cast<CImageElement*>(this->_ve.begin()->get());
	if(!img)
		throw wstring(L"Hip has not been related with an img element");

	_maa[L"value"] = img->GetText(document);
	CInputText::DoFill(document);
}

//void CInputHip::InitElementFromXml(IXmlReader* pReader) throw(...)
//{
//	HRESULT hr;
//	XmlNodeType nodeType;
//	const WCHAR* pwszBuffer;
//
//	
//	//TODO:
//	CInputText::InitElementFromXml(pReader);
//}

void CInputHip::BuildAvailableAttributes() throw()
{
	_maa[L"type"]			= L"";
	_maa[L"trigger"]		= L"onchange";
}

void CInputHip::ValidateAttributes() const throw(...)
{
}